package edu.sctu.zhuyingzhi.month201505.day20150514.listTestOne;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by user13 on 2015/5/13.
 */
public class AddList {

    public List<Worker> add() {


        Worker worker1 = new Worker("朱英志", 12500.0, 18);
        Worker worker2 = new Worker("夏磊", 3500.0, 20);
        Worker worker3 = new Worker("聂宇", 3800.0, 18);
        Worker worker4 = new Worker("黄天林", 1800.0, 22);

        List<Worker> list = new ArrayList();

        list.add(worker1);
        list.add(worker2);
        list.add(worker3);


        for (int i = 0; i < 3; i++) {
            System.out.println(list.get(i).getName() + "\t" + list.get(i).getAge() + "\t" + list.get(i).getSalary());
        }

        System.out.println();

        list.add(3, worker4);
        for (int i = 0; i < 4; i++) {
            System.out.println(list.get(i).getName() + "\t" + list.get(i).getAge() + "\t" + list.get(i).getSalary());
        }

        System.out.println();

        list.remove(worker3);

        for (int i = 0; i < 3; i++) {
            System.out.println(list.get(i).getName() + "\t" + list.get(i).getAge() + "\t" + list.get(i).getSalary());
        }

        return list;
    }


}

